#include <iostream>
#include <vector>

using namespace std;
class Solution
{
public:
    int findPeakElement(vector<int> &nums)
    {
        // 0-5/3-5/5-5
        int start = 0, end = nums.size() - 1;
        while (start != end)
        {
            int i = (start + end) / 2;
            if (i < nums.size() && nums[i] < nums[i + 1])
            {
                start = i + 1;
            }
            else if (i > 0 && nums[i] < nums[i - 1])
            {
                end = i - 1;
            }
            else
            {
                return i;
            }
        }
        return start;
    }
};

int main()
{
    cout << "Code162" << endl;
    Solution s;
    vector<int> nums = {1, 2};
    cout << s.findPeakElement(nums) << endl;
    return 0;
}